<?php echo $this->render('head.phtml');?>
<script src="/static/js/jquery-1.6.4.js"></script>
<script src="/static/js/jquery.validate.js"></script>
<script src="/static/js/messages_cn.js"></script>
<script src="/static/js/region.js"></script>
<script>
    $(function(){
	var s = document.createElement("input");
	s.setAttribute("type", "email");
	if (s.type !== "email")
	{
	  // not support html5 form, use jquery validate
	  // alert("not email, jquery validate");
	  $("form").validate();
	}
	if (window.sessionStorage)
	{
	    $("input[name=username]").val(window.sessionStorage.username);
	    $("input[name=realname]").val(window.sessionStorage.realname);
	    //alert(window.sessionStorage.gender);
	    if (window.sessionStorage.gender == '男')
		$("input#male").attr("checked", true);
	    if (window.sessionStorage.gender == '女')
		$("input#female").attr("checked", true);
	}
	$("form#register").submit(function(){
	    // alert("form submit");
	    if (window.sessionStorage)
	    {
		window.sessionStorage.username = $("input[name=username]").val();
		window.sessionStorage.realname = $("input[name=realname]").val();
		window.sessionStorage.gender = $("input[name=gender]:checked").val();
		// alert($("input[name=gender]:checked").val());
		// return false;
	    }
	});	
    });
      function checkPasswd()
      {
	  var p = $("#password");
	  var rp = $("#repasswd");

	  // p[0], get DOM from jquery object
	  if (p.val() != rp.val())
	      rp[0].setCustomValidity("两次输入密码不相等");
	  else if (p.val().length < 6)
	      p[0].setCustomValidity("密码不能小于6位");
	  else
	  {
	      p[0].setCustomValidity("");
	      rp[0].setCustomValidity("");
	  }
      }

</script>
<style>
label.error{color: red;}
</style>
    <?php echo date('Y-m-d');?>
<div id='div_register_login' class='container_24 div_content ui-corner-all'>
  <div id="div_register" class='grid_13 prefix_1'>
    <label class='register_title'>新用户注册</label> 
    
    <form id="register" action="/account/register-submit" method='post' class="check_form">
      <table id='table_register'>
        <tr>
            <td class="td_desc">省：
            </td>
            <td>
              <select required class="required" id="province_id">
		<?php include_once("QinUtility.class.php");?>
		<?php echo QinUtility::make_options($this->prov_list);?>
              </select>
            </td>
        </tr>
        <tr>
            <td class="td_desc">市：
            </td>
            <td>
              <select required class="required" id="city_id">
              </select>
            </td>
        </tr>
        <tr>
            <td class="td_desc">县：
            </td>
            <td>
              <select required class="required" id="town_id">
              </select>
	      <input type="text" name="region_code" id="city_code"/>
            </td>
        </tr>
        <tr>
            <td class="td_desc">性别：
            </td>
            <td>
              <!-- <select name="gender" size="2" height="20px"> -->
              <!--   <option value="男">男</option> -->
              <!--   <option value="女">女</option> -->
              <!-- </select> -->
              <label><input type="radio" required class="required" name="gender" id="male" value="男"/>男</label>
              <label><input type="radio" name="gender" id="female" value="女"/>女</label>
              
            </td>
        </tr>
        <tr>
            <td class="td_desc">姓名：
            </td>
            <td>
	      <input required class="required" maxlength="5" type="text" name="realname"/>为了您的亲属能查找到你，请填写真实姓名。
            </td>
        </tr>
	<tr>
	  <td class='td_desc'>用户名或电子邮箱：</td>
	  <td><input required class="required" maxlength="64" type='text' name='username' id='input_username' minlength="2" maxlength="30"
		     value='<?php if (isset($this->postRegisterData['username']))echo $this->postRegisterData['username'];?>'/>
	  </td>
	</tr>
	<tr>
	  <td class='td_desc'>密码：</td><td>
	    <input required class="required" type='password' name='password' minlength="6" maxlength="12" id='password' onchange="checkPasswd()"/></td>
	</tr>
	<tr>
	  <td class='td_desc'>再次输入密码：</td><td>
	    <input required class="required" type='password' name='repassword'  minlength="6" maxlength="12" id='repasswd' onchange="checkPasswd()"/>
	  </td>
	</tr>
	<tr>
	  <td class='td_desc'>验证码：</td>
	  <td><input required class="required" type="text" name="captcha" class="required" maxlength="6" value="<?php echo $this->captchaId; ?>" /></td>
	</tr>
	<tr>
	  <td>&nbsp;</td>
	  <td>
	    <span id="captcha">
	      <img id="captcha_img" src="<?php echo $this->captcha_url; ?>" border="0" />
	    </span>
	    <a href="#" id="changeCaptcha">换一张</a>
	  </td>
	</tr>
	<!-- <tr> -->
	<!--   <td>&nbsp;</td><td colspan='2'><input type='checkbox' class="required" name='license' <?php if ($this->postRegisterData['license']) echo 'checked';?> /><label id='lb_declare'>我已阅读并接受<a class='a_declare' href=''>注册协议</a>和<a class='a_declare' href=''>版权声明</a></label></td> -->
	<!-- </tr> -->
	<tr>
	  <td>&nbsp;</td><td><input type='submit' name='' value='注册'/></td>
	</tr>
	<tr>
	  <td></td>
	  <td><span class="red"><?php echo $this->error;?></span></td>
	</tr>
      </table>
    </form>
  </div>

  <div id='vertical_line' class='grid_1'></div>
  <!-- <div id='div_login'  class='grid_8 prefix_1'> -->
  <!--   <label class='register_title'>登录</label>  -->
    
  <!--   <form action="/account/login" method='post' > -->
  <!--     <table id='table_login'> -->
  <!-- 	<tr> -->
  <!-- 	  <td class='td_desc'>用户名或电子邮箱：</td><td><input type='text' id='login_username' class="required" name='username' value="<?php //echo $this->login_user;echo $_COOKIE['username']?>"/></td> -->
  <!-- 	</tr> -->
  <!-- 	<tr> -->
  <!-- 	  <td class='td_desc'>密码：</td><td><input type='password' id='login_password' name='password' class="required"  value='<?php echo $this->login_passwd;?>'/></td> -->
  <!-- 	</tr> -->
  <!-- 	<tr> -->
  <!-- 	  <td>&nbsp;</td><td><label><input type='checkbox' id='login_remember_me' name='remember_me'/>记住我</label></td> -->
  <!-- 	</tr> -->
  <!-- 	<tr> -->
  <!-- 	  <td><label class='lb_error'><?php echo $this->login_error;?></label></td> -->
  <!-- 	</tr> -->
  <!-- 	<tr> -->
  <!-- 	  <td>&nbsp;</td><td><input type='submit' value='登录'/></td> -->
  <!-- 	</tr> -->

  <!--     </table> -->
  <!--   </form> -->
  <!-- </div><\!-- div_login -\-> -->
  <div class='clear'></div>
   
</div>
<?php echo $this->render('foot.phtml');?>
